<?php
include('db.php');
$db = getDb();

$content=file_get_contents("../view/showSchedule.html");


$_ALL_DATA_JSON_="_ALL_DATA_JSON_";
$_ALL_DATA_JSON_content="";

$_DAY1_="_DAY1_";
$_DAY1_content="undef";

$_DAY2_="_DAY2_";
$_DAY2_content="undef";

$_DAY3_="_DAY3_";
$_DAY3_content="undef";

$_DAY4_="_DAY4_";
$_DAY4_content="undef";

$_DAY5_="_DAY5_";
$_DAY5_content="undef";

$_DAY6_="_DAY6_";
$_DAY6_content="undef";


$_DAY7_="_DAY7_";
$_DAY7_content="undef";



$sqlCommand="SELECT s.startDate, d.data FROM userData d JOIN subevent s ON d.subeventId = s.id WHERE d.id=". $_GET["id"];
$result = $db->Execute($sqlCommand);

if ($result === false)
	die($sqlCommand);

while (!$result->EOF)
{
	$_DAY1_content = $result->fields[0];
	$_ALL_DATA_JSON_content= $result->fields[1];
	$result->MoveNext();
}

	$_DAY2_content = date('Y-m-d', strtotime($_DAY1_content .' +1 day'));
	$_DAY3_content = date('Y-m-d', strtotime($_DAY2_content .' +1 day'));
	$_DAY4_content = date('Y-m-d', strtotime($_DAY3_content .' +1 day'));
	$_DAY5_content = date('Y-m-d', strtotime($_DAY4_content .' +1 day'));
	$_DAY6_content = date('Y-m-d', strtotime($_DAY5_content .' +1 day'));
	$_DAY7_content = date('Y-m-d', strtotime($_DAY6_content .' +1 day'));


// Display page
$content = str_replace($_ALL_DATA_JSON_ , $_ALL_DATA_JSON_content, $content);
$content = str_replace($_DAY1_ , $_DAY1_content, $content);
$content = str_replace($_DAY2_ , $_DAY2_content, $content);
$content = str_replace($_DAY3_ , $_DAY3_content, $content);
$content = str_replace($_DAY4_ , $_DAY4_content, $content);
$content = str_replace($_DAY5_ , $_DAY5_content, $content);
$content = str_replace($_DAY6_ , $_DAY6_content, $content);
$content = str_replace($_DAY7_ , $_DAY7_content, $content);
echo $content;
 
?>






<!-- <option value="a">a</option>  -->